Skip to content

fix(e2e): make pastebin share helpers resilient to async clipboard writes#441

Merged
JammingBen merged 1 commit into
mainfrom
fix/pastebin-e2e-clipboard-race
May 18, 2026
Merged

fix(e2e): make pastebin share helpers resilient to async clipboard writes#441
JammingBen merged 1 commit into
mainfrom
fix/pastebin-e2e-clipboard-race

Conversation

@dschmidt
Copy link
Copy Markdown
Contributor

@dschmidt dschmidt commented May 15, 2026

Description

getShareLinkHref/getAnchorHref in support/pages/pastebinPage.ts read the clipboard immediately after clicking the copy button. The app uses @vueuse/core useClipboard() to perform the actual write, and other flows (e.g. password-link creation) may have left a stale "URL\nPassword: ..." value in the clipboard. As a result, the helpers occasionally returned a stale value (e.g. the same alpha link for both alpha and beta).

This is a latent race that became reliably reproducible once @vueuse/core was bumped from 14.2.1 to 14.3.0 (the "useClipboard: Prevents fail in Safari for async operation" change shifted the write to be more asynchronous in Chromium too), which is why the public links tests started failing on PR #439.

Clear the clipboard before clicking and poll until the click handler has written a new non-empty value.

Related Issue

  • Fixes <issue_link>

How Has This Been Tested?

  • test environment:
  • test case 1:
  • test case 2:
  • ...

Types of changes

  • Bugfix
  • Enhancement (a change that doesn't break existing code or deployments)
  • Breaking change (a modification that affects current functionality)
  • Technical debt (addressing code that needs refactoring or improvements)
  • Tests (adding or improving tests)
  • Documentation (updates or additions to documentation)
  • Maintenance (like dependency updates or tooling adjustments)

…ites

getShareLinkHref/getAnchorHref in support/pages/pastebinPage.ts read the
clipboard immediately after clicking the copy button. The app uses
@vueuse/core useClipboard() to perform the actual write, and other flows
(e.g. password-link creation) may have left a stale "URL\nPassword: ..."
value in the clipboard. As a result, the helpers occasionally returned a
stale value (e.g. the same alpha link for both alpha and beta).

This is a latent race that became reliably reproducible once @vueuse/core
was bumped from 14.2.1 to 14.3.0 (the "useClipboard: Prevents fail in
Safari for async operation" change shifted the write to be more
asynchronous in Chromium too), which is why the `public links` tests
started failing on PR #439.

Clear the clipboard before clicking and poll until the click handler has
written a new non-empty value.
@dschmidt dschmidt force-pushed the fix/pastebin-e2e-clipboard-race branch from a64d2bd to a9389fe Compare May 15, 2026 20:28
@dschmidt dschmidt changed the title fix(e2e): make pastebin share helpers resilient to async clipboard fix(e2e): make pastebin share helpers resilient to async clipboard writes May 15, 2026
@dschmidt dschmidt requested a review from Copilot May 15, 2026 20:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a flaky e2e test caused by stale clipboard values when reading share links. The pastebin page helpers now clear the clipboard before clicking and poll until the async useClipboard write completes.

Changes:

  • Added private clickAndReadClipboard helper that clears the clipboard, performs the click, then polls until a non-empty value appears (5s timeout).
  • Refactored getShareLinkHref and getAnchorHref to use this helper.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@JammingBen JammingBen merged commit e910016 into main May 18, 2026
9 checks passed
@JammingBen JammingBen deleted the fix/pastebin-e2e-clipboard-race branch May 18, 2026 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants